<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Manazra.Controllers.BlogViewModel>" %>
<%@ Import Namespace="Manazra.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Blog: <%= Html.Encode(Model.Blog.Title) %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% 
        //logged in user
        Manazra.Models.UserAuth UserAuth = (Manazra.Models.UserAuth)ViewData["UserAuth"];
        
        if (Model.Blog.IsAuthor(UserAuth.UserName)) { %>
        <div class="right bloglink">
            <%= String.Format("<a href='/Blogs/Create?r={0}'>Add Blog Entry</a>", "b_" + (Model.Blog.RecId * 32)) %>
        </div>
    <%} %>
    <h2>Blog: <%= Html.Encode(Model.Blog.Title) %></h2>
    <div class="info">Posted By <%= Html.FormatUserName(Model.Blog.Author, true) %></div>
    <div class="info">Started <%= Html.Encode(String.Format("{0:g}", Model.Blog.CreatedDate)) %></div>
            
    <% if (Model.Blog.IsAuthor(UserAuth.UserName)) { %>
        <div>
            <%= String.Format("<a href='/Blogs/Edit/{0}'>{{Edit Blog}}</a>", Model.Blog.RecId) %>
        </div>        
    <% } %>
    <div>&nbsp;</div>
    
    <% foreach (var item in Model.Entries) { %>    
        <div class="entry">              
            <div class="label">
                <%= String.Format("<a href='/Articles/Details/{0}'>{1}</a>", item.RecId + "_" + Html.Encode(item.Title.Replace(' ', '_')), Html.Encode(item.Title)) %>
            </div>
            <div class="info">                
                Submitted by <%= Html.FormatUserName(item.Author, true) %> 
                at <%= Html.Encode(String.Format("{0:g}", item.CreatedDate)) %>                
            </div>
            <div class="segmentintro">
                <%= Html.Encode(item.Intro) %>... <%= String.Format("<a href='/Articles/Details/{0}'>(Read More)</a>", item.RecId + "_" + Html.Encode(item.Title.Replace(' ', '_'))) %>
            </div>
            <% Html.RenderPartial("~/Views/Articles/UserControls/ArticleStats.ascx", item); %>
        </div>
    <% } %>
    
</asp:Content>

